package com.saicmotor.springboot_demo.model;

import com.saicmotor.springboot_demo.config.ValidateGroup;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

public class User {
    private int id;
    @NotBlank(message = "name cannot be blank",groups = {ValidateGroup.UserAdd.class, ValidateGroup.UserNameDelete.class})
    private String name;
    @Valid
    @NotNull(message = "age cannot be blank",groups = {ValidateGroup.UserAdd.class, ValidateGroup.UserAgeDelete.class})
    @Min(value = 1, message = "age must be bigger than zero")
    private int age;
    private Timestamp createdAt;
    private Timestamp updatedAt;
    private int deleted;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    public Timestamp getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updatedAt = updatedAt;
    }


    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }
}
